import java.io.IOException;
import java.io.InputStream;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import com.xccwk.model.User;

public class Test {
	public static void main(String[] args) throws IOException {
		String resource = "mybatis-config.xml";
		InputStream inputStream = Resources.getResourceAsStream(resource);
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
		
		SqlSession session = sqlSessionFactory.openSession(true);
		try {
//		  User user = (User) session.selectOne("com.yw.test01.UserMapper.selectUser", 1);
//		  System.out.println(user);
			User user =new User();
			user.setId(33l);
			user.setUserName("test");
			session.insert("com.xccwk.mapper.UserMapper.insert",user);
//			session.commit();
			
		} finally {
		  session.close();
		}

	}
}
